package com.zoro.dyformservice.support.web.converter;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.zoro.dyformservice.interfaces.CodeData;

import java.io.IOException;

/**
 * @author zhaoxingwu
 */
public class CodeDataSerializer<T extends CodeData> extends JsonSerializer<T> {



    @Override
    public void serialize(T t, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (t == null) {
            return;
        }
        jsonGenerator.writeString(t.getCode());
    }
}
